/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.creature.monster.plugin;

import java.awt.Image;
import model.creature.monster.DefaultFullyFunctionalMonster;
import model.creature.moving_creature.ActionType;
import model.creature.moving_creature.Direction;
import model.game.GameInterface;
import model.map.cell.Cell;
import model.utility.ImageUtility;

/**
 *
 * @author Reinhard
 */
public class Pig extends DefaultFullyFunctionalMonster {

    public Pig(GameInterface game, Cell cell) {
        super(game, cell);
    }

    @Override
    public int getSpeed() {
        return 2;
    }

    @Override
    public int getMaxHP() {
        return 150;
    }

    @Override
    public String getName() {
        return "Pig";
    }

    @Override
    public String getDescription() {
        return "Pink animal";
    }

    @Override
    public Image getImage() {
        return ImageUtility.loadImage("resources/pictures/pig/ghost.png");
    }

    @Override
    public int getPower() {
        return 30;
    }

    @Override
    protected int howImportantIsFacingThis(model.map.cell.Cell cell) {
        if (game_.getCreatures().getCrystals().containsCrystalAt(cell)) {
            return 1;
        }
        return 0;
    }

    @Override
    protected ActionType getActionType(Cell cell, Direction dir) {
        Cell front = game_.getMaps().getCellInFrontOff(cell, dir);
        if (!game_.getCreatures().getSprites().getAllSpritesAt(front).isEmpty()) {
            return ActionType.kActionHostileAttack;
        }
        if (game_.getCreatures().getCrystals().containsCrystalAt(front)) {
            return ActionType.kActionHostileAttack;
        }
        //random movement
        return ActionType.getMoveFromDirection(Direction.valueOf(rand_.nextInt(4)));

    }
}
